<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: 储依明
  Date: 2020/7/21
  Time: 20:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>JSTl的使用</title>
</head>
<body>
${pageContext.setAttribute("score","A")}
<c:if test="${score eq 'A'}">
    优秀
</c:if>

<%--对成绩进行判断--%>
<c:choose>
    <c:when test="${score eq 'A'}">优秀</c:when>
    <c:when test="${score eq 'B'}">良好</c:when>
    <c:when test="${score eq 'C'}">及格</c:when>
    <c:when test="${score eq 'D'}">不及格</c:when>
    <c:otherwise>成绩非法</c:otherwise>
</c:choose>

<%
    ArrayList<String> list = new ArrayList<>();
    list.add("aa");
    list.add("aa");
    list.add("aa");
    list.add("aa");
    pageContext.setAttribute("list", list);
%>

<%--遍历集合--%>
<c:forEach items="${list}" var="str">
    ${str}<br>
</c:forEach>
</body>
</html>
